<!DOCTYPE html>
<HTML>
<HEAD>
    <TITLE> ZTREE DEMO - Radio halfCheck</TITLE>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type">
    <link href="../../../css/demo.css" rel="stylesheet" type="text/css">
    <link href="../../../css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css">
    <script src="../../../js/jquery-1.4.4.min.js" type="text/javascript"></script>
    <script src="../../../js/jquery.ztree.core.js" type="text/javascript"></script>
    <script src="../../../js/jquery.ztree.excheck.js" type="text/javascript"></script>
    <!--
    <script type="text/javascript" src="../../../js/jquery.ztree.exedit.js"></script>
    -->
    <SCRIPT type="text/javascript">
        <!--
        var setting = {
            async: {
                enable: true,
                url: "../asyncData/getNodes.php",
                autoParam: ["id", "name=n", "level=lv"],
                otherParam: {"chk": "chk"}
            },
            check: {
                enable: true,
                autoCheckTrigger: true,
                chkStyle: "radio",
                radioType: "level"
            },
            data: {
                simpleData: {
                    enable: true
                }
            },
            callback: {
                onAsyncSuccess: onAsyncSuccess
            }
        };

        function onAsyncSuccess(event, treeId, treeNode, msg) {
            cancelHalf(treeNode);
        }

        function cancelHalf(treeNode) {
            var zTree = $.fn.zTree.getZTreeObj("treeDemo");
            treeNode.halfCheck = false;
            zTree.updateNode(treeNode);
        }

        var zNodes = [
            {id: 1, pId: 0, name: "half 1", halfCheck: true, isParent: true},
            {id: 2, pId: 0, name: "half 2", halfCheck: true, checked: true, isParent: true},
            {id: 3, pId: 0, name: "no half 3", isParent: true}
        ];

        $(document).ready(function () {
            $.fn.zTree.init($("#treeDemo"), setting, zNodes);
        });
        //-->
    </SCRIPT>
</HEAD>

<BODY>
<h1>Radio halfCheck Demo</h1>
<h6>[ File Path: excheck/radio_halfCheck.html ]</h6>
<div class="content_wrap">
    <div class="zTreeDemoBackground left">
        <ul class="ztree" id="treeDemo"></ul>
    </div>
    <div class="right">
        <ul class="info">
            <li class="title"><h2>1, Explanation of Demo</h2>
                <ul class="list">
                    <li>This demo implements the check operation of the dynamic tree</li>
                    <li class="highlight_red">1). After loaded child nodes, the parent node's 'halfCheck' attribute will
                        be invalid immediately.
                    </li>
                    <li class="highlight_red">2). If you check the parent node, will not effect the child nodes's check
                        status.
                    </li>
                    <li class="highlight_red">3). If you check the parent node, it's child node's 'halfCheck' attribute
                        will still be valid.
                    </li>
                </ul>
            </li>
            <li class="title"><h2>2, Explanation of setting</h2>
                <ul class="list">
                    <li>Half-checked functional don't need to configure any parameter. But it is accessibility, can not
                        used alone. So please configure the parameters which you need.
                    </li>
                </ul>
            </li>
            <li class="title"><h2>3, Explanation of treeNode</h2>
                <ul class="list">
                    <li class="highlight_red">1), Please set treeNode.halfCheck attribute, before zTree initialize. See
                        the API documentation for more related contents.
                    </li>
                    <li>2), By the way, please see the 'Radio Operation' Demo.</li>
                </ul>
            </li>
        </ul>
    </div>
</div>
</BODY>
</HTML>